<style scoped>

.extendGroup {
  float: right;
  margin-right: 20px;
  opacity: 0;
}

.el-tree-node__content:hover .extendGroup {
  opacity: 1;
}
.currenImg img{width:27px;height:27px;vertical-align: middle;margin-right:5px;}
</style>

<template>
  <div>
     
      <template v-if="routerPath=='currency'" >
        <div v-loading="loading">
         
        <!-- 操作 -->
        <!--工具条-->
        <el-col :span="24" class="toolbar table_toolbar" style="padding-bottom: 0px;">
          <el-form :inline="true" :model="filters">
           <!--  <el-form-item class="table_input">
              <el-input v-model="filters.name" placeholder="根据身份证号/姓名/账号/电话号码检索"></el-input>
            </el-form-item>
            <el-form-item class="table_i">
              <el-button type="primary" v-on:click="fetchData"><i class="el-icon-search"></i></el-button>
            </el-form-item> -->
            <el-form-item class="" >
              <el-button class="table_btn_r" type="primary"  @click="handleAdd">新增币种</el-button>
            </el-form-item>
          </el-form>
        </el-col>
    
        <!-- table start  -->
        <el-table :data="list" style="width: 100%">
          <el-table-column width="37">
            <template scope="scope">
              <img src="../assets/img/sysFile.gif">
            </template>
          </el-table-column> 
          <el-table-column label="ID"     type="index"    width="60">
          </el-table-column>
          <el-table-column prop="name" label="名称">
          </el-table-column>
          <el-table-column prop="title" label="标题" >
          </el-table-column>
          
          <el-table-column prop="iconResId" label="图片" width="170">
            <template scope="scope">
              <img :src="scope.row.iconResUrl" width="50" height="50" />
            </template>
          </el-table-column>          
          <el-table-column prop="coinType" label="类型">
          </el-table-column>
          <el-table-column prop="scale" label="小数位数">
          </el-table-column>
          <el-table-column prop="feeRate" label="手续费率">
          </el-table-column>
          <el-table-column prop="createTime" label="添加时间">
          </el-table-column>
          </el-table-column>
          <el-table-column prop="modifiedTime" label="修改时间">
          </el-table-column>
        <!--   <el-table-column label="状态" prop="posStat" >
            <template scope="scope" >
                <el-tooltip :content="'停用/正常 ' " placement="top">
                  <el-switch
                    v-model="scope.row.posStat"
                     @change="toggleStatus(scope.row)"

                    active-color="#15c288"
                    inactive-color="#cacaca"
                    active-value="1"
                    inactive-value="2">
                  </el-switch>           
                </el-tooltip>
              </template>
           
          </el-table-column> -->
        <!--   <el-table-column prop="userGender" label="状态"  :formatter="formatSex">
            
          </el-table-column> -->
          <el-table-column prop="status" label="状态" :formatter="formatSex">
           <!--  <template slot-scope="scope">
              <span v-if="scope.row.status==1" >启用</span>
              <span v-if="scope.row.status==2" class="span_red">禁用</span>
            </template> -->
          </el-table-column>
 
          <el-table-column label="操作">
            <template slot-scope="scope">
       
              <span class="span_btn" v-if="isEdit"  @click="handleEdit(scope.$index, scope.row)" >编辑</span>
             
            </template>
          </el-table-column>
        </el-table>
          <!--工具条-->
        <el-col :span="24" class="toolbar toolbar_footer">
          <el-pagination v-if="total" background layout="prev, pager, next,total,jumper" @current-change="handleCurrentChange" :page-size="showCount" :total="total" style="float:right;">
          </el-pagination>
        </el-col>
        <!-- table end  -->


        <!-- 新增页面 -->
         <el-dialog title="添加币种" top="0" :modal="false" :lock-scroll="false" class="form_part" :visible.sync="addFormVisible"  :close-on-click-modal="true">
          <el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
            <!-- <div class="form_left"> -->
              <el-form-item label="名称(英文小写):" prop="name">
                <el-input v-model="addForm.name" auto-complete="off"></el-input>
              </el-form-item>
              <el-form-item label="标题:" prop="title">
                <el-input v-model="addForm.title" auto-complete="off"></el-input>
              </el-form-item>      
              <el-form-item label="图片:" prop="iconResId">
                <!-- <el-input v-model="addForm.iconResId" @focus="choiceImg()"></el-input> -->
                <el-select v-model="addForm.iconResId" placeholder="请选择">
                  <el-option
                    v-for="item in iconResImg"
                    :key="item.resId"
                    :label="item.resId"
                    :value="item.resId">
                    <span class="currenImg" style="float: left"><img :src="item.url">{{ item.name }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.resId }}</span>
                  </el-option>
                </el-select>
              </el-form-item>     
            <!--   <el-form-item label="图片" prop="feeCover" >
               <img v-if="addForm.feeCover" :src="addForm.feeCover" class="avatar">

                <div  class="avatar-uploader"><div tabindex="0" class="el-upload el-upload--text"><i  class="el-icon-plus avatar-uploader-icon"></i> <div  class="file_btn"><button @click="handleBtnClick('cover')"  type="button" class="el-button el-button--primary el-button--small"><span>上传</span></button> <div  slot="tip" class="el-upload__tip">只能上传jpg/png文件<span class="imgspan">规格：540像素*300像素</span></div></div><input  @change="onUpload" type="file" id="uploadfile"  name="file" class="el-upload__input"></div></div>

              </el-form-item>  -->       
              <el-form-item label="钱包类型" prop="walletType">
                <el-select v-model="addForm.walletType" placeholder="请选择">
                  <el-option label="其它" value="0"></el-option>
                  <el-option label="比特币系列" value="1"></el-option>
                  <el-option label="以太坊系列" value="2"></el-option>
                  <el-option label="以太坊代币" value="3"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="币种类型" prop="coinType">
                <el-select v-model="addForm.coinType" placeholder="请选择">
                  <el-option label="钱包币" value="1"></el-option>                  
                  <el-option label="认购币" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="小数位数:" prop="scale">
                <el-input v-model="addForm.scale" auto-complete="off"></el-input>
              </el-form-item>
                <el-form-item label="手续费率:" prop="feeRate">
                <el-input v-model="addForm.feeRate" auto-complete="off"></el-input>
              </el-form-item>

            <!-- </div> -->
            <!-- <div class="form_right"> -->
             <!--   <el-form-item label="性别:" prop="userGender">
                <el-radio-group v-model="addForm.userGender">
                  <el-radio class="radio" :label="1">男</el-radio>
                  <el-radio class="radio" :label="2">女</el-radio>
                </el-radio-group>
              </el-form-item> -->
                <el-form-item label="钱包服务地址:" prop="rpcIp">
                <el-input v-model="addForm.rpcIp" auto-complete="off"></el-input>
              </el-form-item>
             
              <el-form-item label="钱包服务端口:" prop="rpcPort">
                <el-input v-model="addForm.rpcPort" auto-complete="off"></el-input>
              </el-form-item>
              <el-form-item label="钱包用户名:" prop="rpcUser">
                <el-input v-model="addForm.rpcUser" auto-complete="off"></el-input>
              </el-form-item>
               <el-form-item label="钱包密码:" prop="rpcPassword">
                <el-input v-model="addForm.rpcPassword" auto-complete="off"></el-input>
              </el-form-item>
              <el-form-item label="状态" prop="status">
                <el-select v-model="addForm.status" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="充值" prop="isAllowRecharge">
                <el-select v-model="addForm.isAllowRecharge" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                  <el-option label="缓慢" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="提现" prop="isAllowWithdraw">
                <el-select v-model="addForm.isAllowWithdraw" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                  <el-option label="缓慢" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="交易" prop="isAllowTrade">
                <el-select v-model="addForm.isAllowTrade" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                </el-select>
              </el-form-item>
            <!-- </div> -->
           
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary"  @click.native="addSubmit('addForm')" :loading="addLoading">保存</el-button>
            <el-button type="primary" @click.native="addFormVisible = false">取消</el-button>

          </div>
        </el-dialog>

         <!-- 编辑页面 -->
         <el-dialog title="修改币种" top="0" :modal="false" :lock-scroll="false" class="form_part" :visible.sync="editFormVisible"  :close-on-click-modal="true">
          <el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editForm">
              <el-form-item label="名称(英文小写):" prop="name">
                <el-input v-model="editForm.name" auto-complete="off" disabled></el-input>
              </el-form-item>
              <el-form-item label="标题:" prop="title">
                <el-input v-model="editForm.title" auto-complete="off"></el-input>
              </el-form-item>      
              <el-form-item label="图片:" prop="iconResId">
                <!-- <el-input v-model="editForm.iconResId" auto-complete="off"></el-input> -->
                  <el-select v-model="editForm.iconResId" placeholder="请选择">
                  <el-option
                    v-for="item in iconResImg"
                    :key="item.resId"
                    :label="item.resId"
                    :value="item.resId">
                    <span class="currenImg" style="float: left"><img :src="item.url">{{ item.name }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.resId }}</span>
                  </el-option>
                </el-select>
              </el-form-item>                    
              <el-form-item label="钱包类型" prop="walletType">
                <el-select v-model="editForm.walletType" placeholder="请选择">
                  <el-option label="其它" value="0"></el-option>
                  <el-option label="比特币系列" value="1"></el-option>
                  <el-option label="以太坊系列" value="2"></el-option>
                  <el-option label="以太坊代币" value="3"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="币种类型" prop="coinType">
                <el-select v-model="editForm.coinType" placeholder="请选择">
                  <el-option label="钱包币" value="1"></el-option>                  
                  <el-option label="认购币" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="小数位数:" prop="scale">
                <el-input v-model="editForm.scale" auto-complete="off"></el-input>
              </el-form-item>
                <el-form-item label="手续费率:" prop="feeRate">
                <el-input v-model="editForm.feeRate"  disabled auto-complete="off"></el-input>
              </el-form-item>
                <el-form-item label="钱包服务地址:" prop="rpcIp">
                <el-input v-model="editForm.rpcIp" auto-complete="off"></el-input>
              </el-form-item>             
              <el-form-item label="钱包服务端口:" prop="rpcPort">
                <el-input v-model="editForm.rpcPort" auto-complete="off"></el-input>
              </el-form-item>
              <el-form-item label="钱包用户名:" prop="rpcUser">
                <el-input v-model="editForm.rpcUser" auto-complete="off"></el-input>
              </el-form-item>
               <el-form-item label="钱包密码:" prop="rpcPassword">
                <el-input v-model="editForm.rpcPassword" auto-complete="off"></el-input>
              </el-form-item>
              <el-form-item label="状态" prop="status">
                <el-select v-model="editForm.status" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="充值" prop="isAllowRecharge">
                <el-select v-model="editForm.isAllowRecharge" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                  <el-option label="缓慢" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="提现" prop="isAllowWithdraw">
                <el-select v-model="editForm.isAllowWithdraw" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                  <el-option label="缓慢" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="交易" prop="isAllowTrade">
                <el-select v-model="editForm.isAllowTrade" placeholder="请选择">
                  <el-option label="禁用" value="0"></el-option>                  
                  <el-option label="启用" value="1"></el-option>
                </el-select>
              </el-form-item>
 
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click.native="editSubmit('editForm')" :loading="editLoading">保存</el-button>
            <el-button type="primary" @click.native="editFormVisible = false">取消</el-button>

          </div>
        </el-dialog>
      </div>
      </template>
       <template v-else>
        <router-view></router-view>
      </template>
  </div>

  
  
</template>

<script>
import * as currency from '../api/currency';
import isvalidPhone from '../api/valide';
import qs from 'qs';
import md5 from 'js-md5';

let myMixin = {
  data: function() {
    return { currency }
  }
}
var validPhone=(rule, value,callback)=>{
      if (!value){
          callback(new Error('请输入电话号码'))
      }else  if (!isvalidPhone.isvalidPhone(value)){
        callback(new Error('请输入正确的11位手机号码'))
      }else {
          callback()
      }
  }
export default {
  mixins: [myMixin],
  data() {
    return {
      type:1,
      iconResImg:[
        {name:'',resId:'10000001',url:require('../assets/img/btc.png')},
      ],
      isDel:true,
      isEdit:true,
      isReleRole:true,
      isReleGroup:true,
      total: 10,
      page: 1,
      showCount:10,
      routerPath:'',
      filters:{name:''},//搜索表单
      addFormVisible:false,//新增页面是否显示,
      editFormVisible:false,//编辑界面是否显示
      addForm:{coinType:'1',walletType:'1',status:"1",isAllowRecharge:"1",isAllowWithdraw:"1",isAllowTrade:"1",iconResId:'10000001'},//新增页面数据
      editForm:{},//编辑页面数据
      addFormRules:{
        name: [
            { required: true, message: '请输入名称', trigger: 'blur' }
          ],
        title: [
          { required: true, message: '请输入标题', trigger: 'blur' }
        ],
        iconResId: [
          { required: true, message: '请输入图标', trigger: 'change' }
        ],
        coinType: [
          { required: true, message: '请选择币种', trigger: 'blur' }
        ],
        /*phoneNum: [
          // { required: true, message: '请输入手机号', trigger: 'blur' }
          { required: true, trigger: 'blur', validator:validPhone }//这里需要用到全局变量

        ],*/
        feeRate: [
          { required: true, message: '请输入手续费费率', trigger: 'blur' }
        ],
        rpcIp: [
          { required: true, message: '请输入钱包服务地址', trigger: 'blur' }
        ],
        rpcPort: [
          { required: true, message: '请输入钱包服务端口', trigger: 'blur' }
        ],
        rpcUser: [
          { required: true, message: '请输入钱包用户名', trigger: 'blur' }
        ],
        rpcPassword: [
          { required: true, message: '请输入钱包密码', trigger: 'blur' }
        ],
        walletType: [
          { required: true, message: '请选择钱包类型', trigger: 'blur' }
        ],
        scale: [
          { required: true, message: '请输入小数位数', trigger: 'blur' }
        ],
        status: [
          { required: true, message: '请选择状态', trigger: 'blur' }
        ],
        isAllowRecharge: [
          { required: true, message: '请选择是否允许充值', trigger: 'blur' }
        ],
        isAllowWithdraw: [
          { required: true, message: '请选择是否允许提现', trigger: 'blur' }
        ],
        isAllowTrade: [
          { required: true, message: '请选择是否允许交易', trigger: 'blur' }
        ],
      },
      editFormRules:{
         name: [
            { required: true, message: '请输入名称', trigger: 'blur' }
          ],
        title: [
          { required: true, message: '请输入标题', trigger: 'blur' }
        ],
        iconResId: [
          { required: true, message: '请输入图标', trigger: 'blur' }
        ],
        coinType: [
          { required: true, message: '请选择币种', trigger: 'blur' }
        ],    
        feeRate: [
          { required: true, message: '请输入手续费费率', trigger: 'blur' }
        ],
        rpcIp: [
          { required: true, message: '请输入钱包服务地址', trigger: 'blur' }
        ],
        rpcPort: [
          { required: true, message: '请输入钱包服务端口', trigger: 'blur' }
        ],
        rpcUser: [
          { required: true, message: '请输入钱包用户名', trigger: 'blur' }
        ],
        rpcPassword: [
          { required: true, message: '请输入钱包密码', trigger: 'blur' }
        ],
        walletType: [
          { required: true, message: '请选择钱包类型', trigger: 'blur' }
        ],
        scale: [
          { required: true, message: '请输入小数位数', trigger: 'blur' }
        ],
        status: [
          { required: true, message: '请选择状态', trigger: 'blur' }
        ],
        isAllowRecharge: [
          { required: true, message: '请选择是否允许充值', trigger: 'blur' }
        ],
        isAllowWithdraw: [
          { required: true, message: '请选择是否允许提现', trigger: 'blur' }
        ],
        isAllowTrade: [
          { required: true, message: '请选择是否允许交易', trigger: 'blur' }
        ],
      },
      addLoading:false,//
      editLoading:false,//
      list: [
        { userName:"test",
          userGender:1,
          loginName:"test",
          loginPass:"test",
          phoneNum:"test",
          userMail:"test",
          certNo:"test",
        },
        { userName:"test",
          userGender:1,
          loginName:"test",
          loginPass:"test",
          phoneNum:"test",
          userMail:"test",
          certNo:"test",
        }
      ],
      canReset: true,
      loading: false,
      coinId:''//币种id
    }
  },
  methods: {

      handleBtnClick: function(val){
        this.uploadbtn=val;
          document.getElementById("uploadfile").click();
      },
      onUpload(e){//上传图片
        let that = this;
        let parame = {fileSuffix: '.jpg'};
        OssApi.getOssSign(parame, (res) => {
          if (res.retCode == 1) {
            let payTypeForm = new FormData();
            let imgUrl = res.data.fileUrl;
            payTypeForm.append('OSSAccessKeyId', res.data.ossKeyId);
            payTypeForm.append('policy', res.data.policy);
            payTypeForm.append('Signature', res.data.signature);
            payTypeForm.append('key', res.data.fileName);
            payTypeForm.append('success_action_status', 200);
            payTypeForm.append('file', e.target.files[0], res.data.fileName);
            let xhr = new XMLHttpRequest();
            xhr.open('POST', Common.ossUploadUrl);
            xhr.send(payTypeForm);
            xhr.onreadystatechange = function () {
              if (xhr.readyState == 4 && xhr.status == 200) {
                that.payTypeForm.feeCover = imgUrl;
                that.$message('上传门店logo成功！！！');
              }
            }
          } else {
            that.$message('获取凭证错误！！！');
          }
        })   
      },
     toggleStatus:function(row){
      //状态操作
     /* let para={
        posNo:row.posNo,
        posStat:row.posStat.toString()//1:正常，2：停用
      }
      matterManage.updateDeviceStat(para,(res)=>{
        if(res.retCode==1){
          // this.$message("修改状态成功");

        }else{
          this.$message({
            message: res.retMsg,
            type: 'error'
          });
        }
      })*/
    },
    toggleHG(index,row){
      this.$set(this.list[index],'showIndexG',row.groupList.length)
      this.$set(this.list[index],'showCloseG',true);


    },
    toggleH(index,row){
      this.$set(this.list[index],'showClose',true);
      this.$set(this.list[index],'showIndex',row.roleList.length)
    },
   toggleHGC(index,row){
      this.$set(this.list[index],'showIndexG',2)
      this.$set(this.list[index],'showCloseG',false);


    },
    toggleHC(index,row){
      this.$set(this.list[index],'showClose',false);
      this.$set(this.list[index],'showIndex',2)
    },
    //性别显示转换
    formatSex: function (row, column) {
      return row.status == 1 ? '启用' : row.userGender == 0 ? '禁用' : '未知';
    },
    handleCurrentChange(val) {
      this.page = val;
      // this.getUsers();
      this.fetchData();
    },
  

  
    //显示编辑界面
    handleEdit: function (index, row) {
      console.log(row)
      this.editFormVisible = true;
      this.choiceImg();
      
      this.coinId=row.coinId;
        let para={
        coinId:row.coinId
       }
        currency.info.r(para).then((res) => {
          console.log(res)
          if(res.data.retCode==1){
              this.editForm=res.data.data;
              this.editForm.walletType=this.editForm.walletType.toString();
              this.editForm.coinType=this.editForm.coinType.toString();
              this.editForm.status =this.editForm.status.toString();
              this.editForm.isAllowWithdraw =this.editForm.isAllowWithdraw.toString();
              this.editForm.isAllowRecharge =this.editForm.isAllowRecharge.toString();
              this.editForm.isAllowTrade =this.editForm.isAllowTrade.toString();

          }else{
            this.$message(res.data.retMsg);
          }              
      })
    },
    //显示新增界面
    handleAdd: function () {
      // this.$router.push({path:"/add"});
     this.addFormVisible = true;
      this.choiceImg();
    },
    addSubmit:function(){
      //新增数据提交
        this.$refs.addForm.validate((valid) => {
          if (valid) {
             let para = {
              name:this.addForm.name,
              title:this.addForm.title,
              // loginPass:md5('STARSAND_' + this.addForm.loginPass),         

               iconResId:this.addForm.iconResId,
              coinType:this.addForm.coinType,
              feeRate:this.addForm.feeRate,
              rpcIp:this.addForm.rpcIp,
              rpcPort:this.addForm.rpcPort,
              rpcUser:this.addForm.rpcUser,
              rpcPassword:this.addForm.rpcPassword,
              walletType:this.addForm.walletType,
              scale:this.addForm.scale,
              status:this.addForm.status,
              isAllowRecharge:this.addForm.isAllowRecharge,
              isAllowWithdraw:this.addForm.isAllowWithdraw,
              isAllowTrade:this.addForm.isAllowTrade,           
            };
            console.log(para);
            // return;
            currency.add.r(para).then((res) => {
              if(res.data.retCode==1){
                //添加用户成功
                this.addFormVisible = false;

                this.fetchData();
              }else{
                this.$message(res.data.retMsg);
              }
              
            });
          }else{
            console.log('error submit!!');
            return false;
          }
        })

    },
    editSubmit:function(){
      //编辑数据提交
      this.$refs.editForm.validate((valid) => {
          if (valid) {
           /* let para=this.editForm;
            para.coinId=this.coinId;*/
             let para = {
              coinId:this.coinId,
              // name:this.editForm.name,
              title:this.editForm.title,

              // loginPass:md5('STARSAND_' + this.addForm.loginPass),          

               iconResId:this.editForm.iconResId,
              coinType:this.editForm.coinType,
              // feeRate:this.editForm.feeRate,
              rpcIp:this.editForm.rpcIp,
              rpcPort:this.editForm.rpcPort,
              rpcUser:this.editForm.rpcUser,
              rpcPassword:this.editForm.rpcPassword,
              walletType:this.editForm.walletType,
              scale:this.editForm.scale,
              status:this.editForm.status,
              isAllowRecharge:this.editForm.isAllowRecharge,
              isAllowWithdraw:this.editForm.isAllowWithdraw,
              isAllowTrade:this.editForm.isAllowTrade,  
           
            };
            console.log(para);
            // return;
            currency.modify.r(para).then((res) => {
              if(res.data.retCode==1){
                //编辑用户成功
                this.editFormVisible = false;

                this.fetchData();
              }else{
                this.$message(res.data.retMsg);
              }
              
            });
          }else{
            console.log('error submit!!');
            return false;
          }
      })
    },
    choiceImg(){
      //选择币种图片
       let para = {
          type:this.type,
        };

      currency.requestResource.r(para).then((res) => {
        console.log(res);
        if(res.data.retCode==1){
          this.iconResImg = res.data.data.list;

        }else{
          this.$message.error(res.data.retMsg);
        }
   
      });
    },
    fetchData(init) {
      // this.loading = true;
      /*if(!this.$_has([currency.request])){
        this.$message("暂无权限");
        this.loading = false;

        return;
      }*/
      let para = {
          showCount:this.showCount,
          currentPage:this.page,//当前查询页
          // name:this.filters.name
        };

      currency.request.r(para).then((res) => {
        console.log(res);
        this.total=parseInt(res.data.data.totalRow);
        this.list = res.data.data.list;
   
        this.loading = false;
      });
    },
    requestNotAllowed: function(){
      currency.notAllowed.r();
    }
  },
  watch: {
          // 如果路由有变化，会再次执行该方法
          "$route": function(){
            this.routerPath=this.$route.path.split("/").pop();
            this.fetchData(true)

          }
  },
  created() {
   /* this.isReleRole=this.$_has([users.releRolesUser]);
    this.isReleGroup=this.$_has([users.releGroupUser]);
    this.isEdit=this.$_has([users.modify]);
    this.isDel=this.$_has([users.remove]);
    if(this.$route.query.groupId!=undefined&&this.$route.query.groupId!="undefined"&&this.$route.query.groupId!=""){
      this.groupId=this.$route.query.groupId;
    }*/

    this.fetchData(true)
    this.routerPath=this.$route.path.split("/").pop();
    

  }
}
</script>